package thread_01;

import java.util.concurrent.locks.ReentrantLock;

public class Demo41 {
    public static void main(String[] args) {
        ReentrantLock lock = new ReentrantLock(true);
//        加锁
        lock.lock();
//        有时候可能忘记执行解锁操作
        try {
            lock.lock();
        } finally {
            lock.unlock();
        }
//        解锁
        lock.unlock();
    }
}
